package org.example.project.bookstore.controller;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.example.project.bookstore.service.SeckillService;
import org.example.util.JsonResult;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther:Liu
 * @Testname:SeckillController
 * @Date:2025/8/28 16:58
 */
@CrossOrigin
@RestController
@RequestMapping("/seckill")
public class SeckillController {

    @Resource
    private SeckillService seckillService;

    @GetMapping("/load")
    public JsonResult loadSeckill() {
        return seckillService.loadSeckill();
    }

    @PostMapping
    public JsonResult seckill(String seckillId, HttpServletRequest request) {
        return seckillService.seckill(seckillId, request);
    }
}
